package pl.edu.agh.transstat.statictisc;

import java.util.List;

public class StandardDeviation extends Function {

	public StandardDeviation(){
		name = "dev";
	}
	
	@Override
	public double getValue(List<Double> values) {
		double mean = new Mean().getValue(values);
		double o = 0;
		for (Double val:values){
			double diff = val - mean;
			o += diff*diff;
		}
		return Math.sqrt(o/values.size());
	}

}
